<template>
	<view class="content">
		<!-- <form @submit="formSubmit"> -->
		<view class="form" v-for="(item,index) in list" :key=index>
			<view class="formch">
				<view>姓名</view>
				<view>{{ item.username }}</view>
			</view>
			<view class="xian"></view>
			<view class="formch">
				<view>手机号</view>
				<view>{{ item.mobile }}</view>
			</view>
			<view class="xian"></view>
			<view class="formch">
				<view>亩数</view>
				<view>{{ item.landarea }}</view>
			</view>
			<view class="xian"></view>
			<view class="formch">
				<view>联系人地址</view>
				<view>{{ item.address }}</view>
			</view>
		<!-- 	<view><button :disabled="item.status==1"  @click="formSubmit(item.id)" class="button">承包</button></view> -->
		</view>
		<!-- <view v-if="popupdata" class="popup1"></view>
		<view v-if="popupdata" class="popup">
			<view v-if="outdata" class="setpop">确认承包该土地？</view>
			<view v-if="!outdata" class="setpop">请线下联系该农户</view>
			<view class="setpopch" v-if="outdata">
				<view class="quding" @click="closes2">取消</view>
				<view class="quding" @click="closes">确定</view>
			</view>
			<view class="bottoms" v-if="!outdata" @click="goods">好的</view>
		</view> -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [],
			input: '',
			popupdata: false,
			outdata: false,
			page: 1,
			last_page: 1,
			address:''
		};
	},
	onReachBottom() {
		this.page++
		this.loadData()
		// if (this.last_page - this.page >= 0) {
		// 	// this.loadData();
		// 	this.page++;
		// }
	},
	onLoad(options) {
		
		this.address=options.address
		console.log(this.address)
		this.loadData();
		// this.getdata()
	},
	methods: {
		//  async getdata(){
		//    let res = await this.$http.post('/api/user/userinfo');
		//    let list=res.data.data.userinfo
		//      // this.id=list.isrent
		// console.log(this.list)
		//  },
		// loadData() {
		// 	var arr = [];
		// 	this.$http.post('/api/Index/get_village_detail',{address:this.address}).then(res => {
		// 		this.last_page = res.data.data.last_page;
		// 		if (this.page == 1) {
		// 			for (let i = 0; i < res.data.data.length; i++) {
		// 				if (res.data.data[i].status == 0||res.data.data[i].status ==1) {
		// 					arr.push(res.data.data[i]);
		// 				}
		// 				// console.log(res.data.data[i].status);
		// 			}
		// 			this.list = arr;
				
		// 		} else {
		// 			this.list = this.list.concat(res.data.data.data);
		// 			// console.log(this.list)
		// 		}
		// 	});
			
		// 	// && this.status=='1'
		// },
		loadData(){
			this.$http.post('/api/Index/get_village_detail',{
				address:this.address,
				limit: '15',
				page:this.page,
				}).then(res => {
				this.list=this.list.concat(res.data.data.data)
				console.log(res.data.data)
			})
		},
		goods() {
			this.popupdata = false;
		},
		closes2() {
			this.outdata = false;
			this.popupdata = false;
		},
		async closes() {
			let res = await this.$http.post('/api/index/set_rent', { id: this.id, status: '1' });
			this.$u.toast('操作成功');
			 this.loadData();
			this.outdata = false;
		},
		formSubmit(data) {
			this.id = data;
			this.popupdata = true;
			this.outdata = true;
		},
		sureout() {
			this.popupdata = true;
			this.outdata = false;
		}
	}
};
</script>

<style scoped>
.content {
	background-color: #f8f8f8;
	width: 100%;
	min-height: 100vh;
	padding: 15px;
	font-size: 15px;
}

.form {
	background-color: white;
	padding: 21px 16px 19.5px 15.5px;
	border-radius: 10px;
	margin-bottom: 10px;
}

.formch {
	/* background-color: white; */
	display: flex;
	justify-content: space-between;
}

.xian {
	height: 0.5px;
	background: rgba(0, 0, 0, 0.1);
	margin: 20px 0;
}

.button {
	width: 268px;
	line-height: 44px;
	background-color: #3fc377;
	color: #ffffff;
	margin-top: 26.5px;
	font-size: 15px;
}
.color {
	background-color: #e5e5e5;
	color: #a8a8a8;
}
.bottom {
	display: flex;
	padding: 0 39px;
	justify-content: space-between;
}

.bottom button {
	width: 125px;
	line-height: 44px;
	background-color: #3fc377;
	color: #ffffff;
	margin-top: 26.5px;
	font-size: 15px;
}

.popup1 {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #000;
	opacity: 0.7;
	filter: alpha(opacity=50);
	z-index: 100;
}

.popup {
	position: fixed;
	top: 200px;
	left: 38px;
	width: 291px;
	/* height:564upx; */
	background: #fff;
	margin-left: 12upx;
	border-radius: 10upx;
	font-weight: 600;
	z-index: 102;
}

.setpop {
	text-align: center;
	margin-top: 39.5px;
	margin-bottom: 46px;
	font-size: 18px;
}

.setpopch {
	display: flex;
	justify-content: space-between;
	padding: 0 12px 13.5px;
}

.setpopch view {
	width: 125px;
	line-height: 44px;
	text-align: center;
	border-radius: 5px;
}

/* .setpopch :first-child {
    background-color: #E5E5E5;
    color: #A8A8A8;
  }

  .setpopch :last-child {
    background-color: #3FC377;
    color: white;
  } */
.bottoms {
	width: 250px;
	line-height: 44px;
	text-align: center;
	border-radius: 5px;
	background-color: #3fc377;
	color: white;
	margin: 0 auto 13.5px;
}
</style>
